home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / bagman.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  26KB  |  690 lines

  1. /***************************************************************************
  2.  
  3. Bagman memory map (preliminary)
  4.  
  5. driver by Nicola Salmoria
  6. protection emulation by Jarek Burczynski and Andrew Deschenes
  7.  
  8. TODO:
  9. - speech
  10.  
  11.  
  12. 0000-5fff ROM
  13. 6000-67ff RAM
  14. 9000-93ff Video RAM
  15. 9800-9bff Color RAM
  16. 9800-981f Sprites (hidden portion of color RAM)
  17. 9c00-9fff ? (filled with 3f, not used otherwise)
  18. c000-ffff ROM (Super Bagman only)
  19.  
  20. memory mapped ports:
  21.  
  22. read:
  23. a000      PAL16r6 output.
  24. a800      ? (read only in one place, not used)
  25. b000      DSW
  26. b800      watchdog reset?
  27.  
  28. write:
  29. a000      interrupt enable
  30. a001      \ horizontal and vertical flip, I don't know which is which
  31. a002      /
  32. a003      video enable??
  33. a004      coin counter
  34. a007      ?
  35. a800-a805 PAL16r6 inputs. This chip is custom logic used for guards controlling.
  36. b000      ?
  37. b800      ?
  38.  
  39. I/O ports:
  40.  
  41. I/O 8  ;AY-3-8910 Control Reg.
  42. I/O 9  ;AY-3-8910 Data Write Reg.
  43. I/O C  ;AY-3-8910 Data Read Reg.
  44.         Port A of the 8910 is connected to IN0
  45.         Port B of the 8910 is connected to IN1
  46.  
  47. ***************************************************************************/
  48.  
  49. #include "driver.h"
  50. #include "vidhrdw/generic.h"
  51.  
  52.  
  53.  
  54. READ_HANDLER( bagman_pal16r6_r );
  55. void bagman_machine_init(void);
  56. WRITE_HANDLER( bagman_pal16r6_w );
  57.  
  58.  
  59. extern unsigned char *bagman_video_enable;
  60. WRITE_HANDLER( bagman_flipscreen_w );
  61. void bagman_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  62. void bagman_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable, const unsigned char *color_prom);
  63.  
  64.  
  65.  
  66. static struct MemoryReadAddress readmem[] =
  67. {
  68.     { 0x0000, 0x5fff, MRA_ROM },
  69.     { 0x6000, 0x67ff, MRA_RAM },
  70.     { 0x9000, 0x93ff, MRA_RAM },
  71.     { 0x9800, 0x9bff, MRA_RAM },
  72.     { 0xa000, 0xa000, bagman_pal16r6_r },
  73.     { 0xa800, 0xa800, MRA_NOP },
  74.     { 0xb000, 0xb000, input_port_2_r },    /* DSW */
  75.     { 0xb800, 0xb800, MRA_NOP },
  76.     { 0xc000, 0xffff, MRA_ROM },    /* Super Bagman only */
  77.     { -1 }    /* end of table */
  78. };
  79.  
  80. static struct MemoryWriteAddress writemem[] =
  81. {
  82.     { 0x0000, 0x5fff, MWA_ROM },
  83.     { 0x6000, 0x67ff, MWA_RAM },
  84.     { 0x9000, 0x93ff, videoram_w, &videoram, &videoram_size },
  85.     { 0x9800, 0x9bff, colorram_w, &colorram },
  86.     { 0xa000, 0xa000, interrupt_enable_w },
  87.     { 0xa001, 0xa002, bagman_flipscreen_w },
  88.     { 0xa003, 0xa003, MWA_RAM, &bagman_video_enable },
  89.     { 0xc000, 0xffff, MWA_ROM },    /* Super Bagman only */
  90.     { 0x9800, 0x981f, MWA_RAM, &spriteram, &spriteram_size },    /* hidden portion of color RAM */
  91.                                     /* here only to initialize the pointer, */
  92.     { 0xa7ff, 0xa805, bagman_pal16r6_w },    /* PAL16r6 custom logic */
  93.                                                         /* writes are handled by colorram_w */
  94.     { 0x9c00, 0x9fff, MWA_NOP },    /* written to, but unused */
  95.     { 0xa004, 0xa004, coin_counter_w },
  96. #if 0
  97.     { 0xa007, 0xa007, MWA_NOP },    /* ???? */
  98.     { 0xb000, 0xb000, MWA_NOP },    /* ???? */
  99.     { 0xb800, 0xb800, MWA_NOP },    /* ???? */
  100. #endif
  101.     { -1 }    /* end of table */
  102. };
  103.  
  104. static struct MemoryReadAddress pickin_readmem[] =
  105. {
  106.     { 0x0000, 0x5fff, MRA_ROM },
  107.     { 0x7000, 0x77ff, MRA_RAM },
  108.     { 0x8800, 0x8bff, MRA_RAM },
  109.     { 0x9800, 0x9bff, MRA_RAM },
  110. //    { 0xa000, 0xa000, bagman_pal16r6_r },
  111.     { 0xa800, 0xa800, input_port_2_r },
  112.     { 0xb800, 0xb800, MRA_NOP },
  113.     { -1 }    /* end of table */
  114. };
  115.  
  116. static struct MemoryWriteAddress pickin_writemem[] =
  117. {
  118.     { 0x0000, 0x5fff, MWA_ROM },
  119.     { 0x7000, 0x77ff, MWA_RAM },
  120.     { 0x8800, 0x8bff, videoram_w, &videoram, &videoram_size },
  121.     { 0x9800, 0x9bff, colorram_w, &colorram },
  122.     { 0xa000, 0xa000, interrupt_enable_w },
  123.     { 0xa001, 0xa002, bagman_flipscreen_w },
  124.     { 0xa003, 0xa003, MWA_RAM, &bagman_video_enable },
  125.     { 0x9800, 0x981f, MWA_RAM, &spriteram, &spriteram_size },    /* hidden portion of color RAM */
  126.                                     /* here only to initialize the pointer, */
  127. //    { 0xa7ff, 0xa805, bagman_pal16r6_w },    /* PAL16r6 custom logic */
  128.                                                         /* writes are handled by colorram_w */
  129.     { 0x9c00, 0x9fff, MWA_NOP },    /* written to, but unused */
  130.     { 0xa004, 0xa004, coin_counter_w },
  131. #if 0
  132.     { 0xa007, 0xa007, MWA_NOP },    /* ???? */
  133.     { 0xb000, 0xb000, MWA_NOP },    /* ???? */
  134.     { 0xb800, 0xb800, MWA_NOP },    /* ???? */
  135. #endif
  136.     { -1 }    /* end of table */
  137. };
  138.  
  139. static struct IOReadPort readport[] =
  140. {
  141.     { 0x0c, 0x0c, AY8910_read_port_0_r },
  142.     { -1 }    /* end of table */
  143. };
  144.  
  145. static struct IOWritePort writeport[] =
  146. {
  147.     { 0x08, 0x08, AY8910_control_port_0_w },
  148.     { 0x09, 0x09, AY8910_write_port_0_w },
  149.     { -1 }    /* end of table */
  150. };
  151.  
  152.  
  153.  
  154. INPUT_PORTS_START( bagman )
  155.     PORT_START    /* IN0 */
  156.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  157.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  158.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
  159.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  160.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  161.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  162.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  163.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
  164.  
  165.     PORT_START    /* IN1 */
  166.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
  167.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )
  168.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
  169.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  170.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  171.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  172.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  173.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  174.  
  175.     PORT_START    /* DSW */
  176.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
  177.     PORT_DIPSETTING(    0x03, "2" )
  178.     PORT_DIPSETTING(    0x02, "3" )
  179.     PORT_DIPSETTING(    0x01, "4" )
  180.     PORT_DIPSETTING(    0x00, "5" )
  181.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) )
  182.     PORT_DIPSETTING(    0x00, "2C/1C 1C/1C 1C/3C 1C/7C" )
  183.     PORT_DIPSETTING(    0x04, "1C/1C 1C/2C 1C/6C 1C/14C" )
  184.     PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) )
  185.     PORT_DIPSETTING(    0x18, "Easy" )
  186.     PORT_DIPSETTING(    0x10, "Medium" )
  187.     PORT_DIPSETTING(    0x08, "Hard" )
  188.     PORT_DIPSETTING(    0x00, "Hardest" )
  189.     PORT_DIPNAME( 0x20, 0x20, "Language" )
  190.     PORT_DIPSETTING(    0x20, "English" )
  191.     PORT_DIPSETTING(    0x00, "French" )
  192.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Bonus_Life ) )
  193.     PORT_DIPSETTING(    0x40, "30000" )
  194.     PORT_DIPSETTING(    0x00, "40000" )
  195.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
  196.     PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
  197.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  198. INPUT_PORTS_END
  199.  
  200. /* EXACTLY the same as bagman, the only difference is that
  201. Languade dip is replaced by Demo Sounds */
  202. INPUT_PORTS_START( bagmans )
  203.     PORT_START    /* IN0 */
  204.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  205.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  206.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
  207.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  208.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  209.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  210.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  211.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
  212.  
  213.     PORT_START    /* IN1 */
  214.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
  215.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )
  216.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
  217.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  218.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  219.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  220.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  221.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  222.  
  223.     PORT_START    /* DSW */
  224.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
  225.     PORT_DIPSETTING(    0x03, "2" )
  226.     PORT_DIPSETTING(    0x02, "3" )
  227.     PORT_DIPSETTING(    0x01, "4" )
  228.     PORT_DIPSETTING(    0x00, "5" )
  229.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) )
  230.     PORT_DIPSETTING(    0x00, "2C/1C 1C/1C 1C/3C 1C/7C" )
  231.     PORT_DIPSETTING(    0x04, "1C/1C 1C/2C 1C/6C 1C/14C" )
  232.     PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) )
  233.     PORT_DIPSETTING(    0x18, "Easy" )
  234.     PORT_DIPSETTING(    0x10, "Medium" )
  235.     PORT_DIPSETTING(    0x08, "Hard" )
  236.     PORT_DIPSETTING(    0x00, "Hardest" )
  237.     PORT_DIPNAME( 0x20, 0x20, DEF_STR ( Demo_Sounds ) )
  238.     PORT_DIPSETTING(    0x00, DEF_STR ( Off ) )
  239.     PORT_DIPSETTING(    0x20, DEF_STR ( On ) )
  240.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Bonus_Life ) )
  241.     PORT_DIPSETTING(    0x40, "30000" )
  242.     PORT_DIPSETTING(    0x00, "40000" )
  243.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
  244.     PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
  245.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  246. INPUT_PORTS_END
  247.  
  248.  
  249. /* EXACTLY the same as bagman, the only difference is that the START1 button */
  250. /* also acts as the shoot button. */
  251. INPUT_PORTS_START( sbagman )
  252.     PORT_START    /* IN0 */
  253.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  254.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  255.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
  256.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 )    /* double-function button, start and shoot */
  257.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  258.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  259.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  260.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  261.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
  262.  
  263.     PORT_START    /* IN1 */
  264.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
  265.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )
  266.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
  267.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )    /* double-function button, start and shoot */
  268.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  269.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  270.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  271.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  272.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  273.  
  274.     PORT_START    /* DSW */
  275.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
  276.     PORT_DIPSETTING(    0x03, "2" )
  277.     PORT_DIPSETTING(    0x02, "3" )
  278.     PORT_DIPSETTING(    0x01, "4" )
  279.     PORT_DIPSETTING(    0x00, "5" )
  280.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) )
  281.     PORT_DIPSETTING(    0x00, "2C/1C 1C/1C 1C/3C 1C/7C" )
  282.     PORT_DIPSETTING(    0x04, "1C/1C 1C/2C 1C/6C 1C/14C" )
  283.     PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) )
  284.     PORT_DIPSETTING(    0x18, "Easy" )
  285.     PORT_DIPSETTING(    0x10, "Medium" )
  286.     PORT_DIPSETTING(    0x08, "Hard" )
  287.     PORT_DIPSETTING(    0x00, "Hardest" )
  288.     PORT_DIPNAME( 0x20, 0x20, "Language" )
  289.     PORT_DIPSETTING(    0x20, "English" )
  290.     PORT_DIPSETTING(    0x00, "French" )
  291.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Bonus_Life ) )
  292.     PORT_DIPSETTING(    0x40, "30000" )
  293.     PORT_DIPSETTING(    0x00, "40000" )
  294.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
  295.     PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
  296.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  297. INPUT_PORTS_END
  298.  
  299. INPUT_PORTS_START( pickin )
  300.     PORT_START    /* IN0 */
  301.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  302.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  303.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
  304.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  305.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  306.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  307.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  308.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
  309.  
  310.     PORT_START    /* IN1 */
  311.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
  312.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )
  313.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
  314.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  315.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  316.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  317.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  318.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  319.  
  320.     PORT_START    /* DSW */
  321.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) )
  322.     PORT_DIPSETTING(    0x00, "2C/1C 1C/1C 1C/3C 1C/7C" )
  323.     PORT_DIPSETTING(    0x01, "1C/1C 1C/2C 1C/6C 1C/14C" )
  324.     PORT_DIPNAME( 0x06, 0x04, DEF_STR( Lives ) )
  325.     PORT_DIPSETTING(    0x06, "2" )
  326.     PORT_DIPSETTING(    0x04, "3" )
  327.     PORT_DIPSETTING(    0x02, "4" )
  328.     PORT_DIPSETTING(    0x00, "5" )
  329.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Free_Play ) )
  330.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  331.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  332.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  333.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  334.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  335.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  336.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  337.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  338.     PORT_DIPNAME( 0x40, 0x40, "Language" )
  339.     PORT_DIPSETTING(    0x40, "English" )
  340.     PORT_DIPSETTING(    0x00, "French" )
  341.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
  342.     PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
  343.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  344. INPUT_PORTS_END
  345.  
  346.  
  347.  
  348. static struct GfxLayout charlayout =
  349. {
  350.     8,8,    /* 8*8 characters */
  351.     512,    /* 512 characters */
  352.     2,    /* 2 bits per pixel */
  353.     { 0, 512*8*8 },    /* the two bitplanes are separated */
  354.     { 0, 1, 2, 3, 4, 5, 6, 7 },    /* pretty straightforward layout */
  355.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  356.     8*8    /* every char takes 8 consecutive bytes */
  357. };
  358. static struct GfxLayout spritelayout =
  359. {
  360.     16,16,    /* 16*16 sprites */
  361.     128,    /* 128 sprites */
  362.     2,    /* 2 bits per pixel */
  363.     { 0, 128*16*16 },    /* the two bitplanes are separated */
  364.     { 0, 1, 2, 3, 4, 5, 6, 7,    /* pretty straightforward layout */
  365.             8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 },
  366.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  367.             16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 },
  368.     32*8    /* every sprite takes 32 consecutive bytes */
  369. };
  370.  
  371.  
  372.  
  373. static struct GfxDecodeInfo gfxdecodeinfo[] =
  374. {
  375.     { REGION_GFX1, 0, &charlayout,      0, 16 },    /* char set #1 */
  376.     { REGION_GFX1, 0, &spritelayout,    0, 16 },    /* sprites */
  377.     { REGION_GFX2, 0, &charlayout,      0, 16 },    /* char set #2 */
  378.     { -1 } /* end of array */
  379. };
  380.  
  381. static struct GfxDecodeInfo pickin_gfxdecodeinfo[] =
  382. {
  383.     { REGION_GFX1, 0, &charlayout,      0, 16 },    /* char set #1 */
  384.     { REGION_GFX1, 0, &spritelayout,    0, 16 },    /* sprites */
  385.     /* no gfx2 */
  386.     { -1 } /* end of array */
  387. };
  388.  
  389.  
  390.  
  391. static struct AY8910interface ay8910_interface =
  392. {
  393.     1,    /* 1 chip */
  394.     1500000,    /* 1.5 MHz??? */
  395.     { 50 },
  396.     { input_port_0_r },
  397.     { input_port_1_r },
  398.     { 0 },
  399.     { 0 }
  400. };
  401.  
  402.  
  403.  
  404. static struct MachineDriver machine_driver_bagman =
  405. {
  406.     /* basic machine hardware */
  407.     {
  408.         {
  409.             CPU_Z80,
  410.             3072000,    /* 3.072 Mhz (?) */
  411.             readmem,writemem,readport,writeport,
  412.             interrupt,1
  413.         }
  414.     },
  415.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  416.     1,    /* single CPU, no need for interleaving */
  417.     bagman_machine_init,
  418.  
  419.     /* video hardware */
  420.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  421.     gfxdecodeinfo,
  422.     64,64,
  423.     bagman_vh_convert_color_prom,
  424.  
  425.     VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
  426.     0,
  427.     generic_vh_start,
  428.     generic_vh_stop,
  429.     bagman_vh_screenrefresh,
  430.  
  431.     /* sound hardware */
  432.     0,0,0,0,
  433.     {
  434.         {
  435.             SOUND_AY8910,
  436.             &ay8910_interface
  437.         }
  438.     }
  439. };
  440.  
  441. static struct MachineDriver machine_driver_pickin =
  442. {
  443.     /* basic machine hardware */
  444.     {
  445.         {
  446.             CPU_Z80,
  447.             3072000,    /* 3.072 Mhz (?) */
  448.             pickin_readmem,pickin_writemem,readport,writeport,
  449.             interrupt,1
  450.         }
  451.     },
  452.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  453.     1,    /* single CPU, no need for interleaving */
  454.     bagman_machine_init,
  455.  
  456.     /* video hardware */
  457.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  458.     pickin_gfxdecodeinfo,
  459.     64,64,
  460.     bagman_vh_convert_color_prom,
  461.  
  462.     VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
  463.     0,
  464.     generic_vh_start,
  465.     generic_vh_stop,
  466.     bagman_vh_screenrefresh,
  467.  
  468.     /* sound hardware */
  469.     0,0,0,0,
  470.     {
  471.         {
  472.             SOUND_AY8910,
  473.             &ay8910_interface
  474.         }
  475.     }
  476. };
  477.  
  478.  
  479. /***************************************************************************
  480.  
  481.   Game driver(s)
  482.  
  483. ***************************************************************************/
  484.  
  485. ROM_START( bagman )
  486.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  487.     ROM_LOAD( "e9_b05.bin",   0x0000, 0x1000, 0xe0156191 )
  488.     ROM_LOAD( "f9_b06.bin",   0x1000, 0x1000, 0x7b758982 )
  489.     ROM_LOAD( "f9_b07.bin",   0x2000, 0x1000, 0x302a077b )
  490.     ROM_LOAD( "k9_b08.bin",   0x3000, 0x1000, 0xf04293cb )
  491.     ROM_LOAD( "m9_b09s.bin",  0x4000, 0x1000, 0x68e83e4f )
  492.     ROM_LOAD( "n9_b10.bin",   0x5000, 0x1000, 0x1d6579f7 )
  493.  
  494.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  495.     ROM_LOAD( "e1_b02.bin",   0x0000, 0x1000, 0x4a0a6b55 )
  496.     ROM_LOAD( "j1_b04.bin",   0x1000, 0x1000, 0xc680ef04 )
  497.  
  498.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  499.     ROM_LOAD( "c1_b01.bin",   0x0000, 0x1000, 0x705193b2 )
  500.     ROM_LOAD( "f1_b03s.bin",  0x1000, 0x1000, 0xdba1eda7 )
  501.  
  502.     ROM_REGION( 0x0040, REGION_PROMS )
  503.     ROM_LOAD( "p3.bin",       0x0000, 0x0020, 0x2a855523 )
  504.     ROM_LOAD( "r3.bin",       0x0020, 0x0020, 0xae6f1019 )
  505.  
  506.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* data for the TMS5110 speech chip */
  507.     ROM_LOAD( "r9_b11.bin",   0x0000, 0x1000, 0x2e0057ff )
  508.     ROM_LOAD( "t9_b12.bin",   0x1000, 0x1000, 0xb2120edd )
  509. ROM_END
  510.  
  511. ROM_START( bagnard )
  512.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  513.     ROM_LOAD( "e9_b05.bin",   0x0000, 0x1000, 0xe0156191 )
  514.     ROM_LOAD( "f9_b06.bin",   0x1000, 0x1000, 0x7b758982 )
  515.     ROM_LOAD( "f9_b07.bin",   0x2000, 0x1000, 0x302a077b )
  516.     ROM_LOAD( "k9_b08.bin",   0x3000, 0x1000, 0xf04293cb )
  517.     ROM_LOAD( "bagnard.009",  0x4000, 0x1000, 0x4f0088ab )
  518.     ROM_LOAD( "bagnard.010",  0x5000, 0x1000, 0xcd2cac01 )
  519.  
  520.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  521.     ROM_LOAD( "e1_b02.bin",   0x0000, 0x1000, 0x4a0a6b55 )
  522.     ROM_LOAD( "j1_b04.bin",   0x1000, 0x1000, 0xc680ef04 )
  523.  
  524.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  525.     ROM_LOAD( "bagnard.001",  0x0000, 0x1000, 0x060b044c )
  526.     ROM_LOAD( "bagnard.003",  0x1000, 0x1000, 0x8043bc1a )
  527.  
  528.     ROM_REGION( 0x0040, REGION_PROMS )
  529.     ROM_LOAD( "p3.bin",       0x0000, 0x0020, 0x2a855523 )
  530.     ROM_LOAD( "r3.bin",       0x0020, 0x0020, 0xae6f1019 )
  531.  
  532.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* data for the TMS5110 speech chip */
  533.     ROM_LOAD( "r9_b11.bin",   0x0000, 0x1000, 0x2e0057ff )
  534.     ROM_LOAD( "t9_b12.bin",   0x1000, 0x1000, 0xb2120edd )
  535. ROM_END
  536.  
  537. ROM_START( bagmans )
  538.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  539.     ROM_LOAD( "a4_9e.bin",    0x0000, 0x1000, 0x5fb0a1a3 )
  540.     ROM_LOAD( "a5-9f",        0x1000, 0x1000, 0x2ddf6bb9 )
  541.     ROM_LOAD( "a4_9j.bin",    0x2000, 0x1000, 0xb2da8b77 )
  542.     ROM_LOAD( "a5-9k",        0x3000, 0x1000, 0xf91d617b )
  543.     ROM_LOAD( "a4_9m.bin",    0x4000, 0x1000, 0xb8e75eb6 )
  544.     ROM_LOAD( "a5-9n",        0x5000, 0x1000, 0x68e4b64d )
  545.  
  546.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  547.     ROM_LOAD( "a2_1e.bin",    0x0000, 0x1000, 0xf217ac09 )
  548.     ROM_LOAD( "j1_b04.bin",   0x1000, 0x1000, 0xc680ef04 )
  549.  
  550.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  551.     ROM_LOAD( "a2_1c.bin",    0x0000, 0x1000, 0xf3e11bd7 )
  552.     ROM_LOAD( "a2_1f.bin",    0x1000, 0x1000, 0xd0f7105b )
  553.  
  554.     ROM_REGION( 0x0040, REGION_PROMS )
  555.     ROM_LOAD( "p3.bin",       0x0000, 0x0020, 0x2a855523 )
  556.     ROM_LOAD( "r3.bin",       0x0020, 0x0020, 0xae6f1019 )
  557.  
  558.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* data for the TMS5110 speech chip */
  559.     ROM_LOAD( "r9_b11.bin",   0x0000, 0x1000, 0x2e0057ff )
  560.     ROM_LOAD( "t9_b12.bin",   0x1000, 0x1000, 0xb2120edd )
  561. ROM_END
  562.  
  563. ROM_START( bagmans2 )
  564.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  565.     ROM_LOAD( "a4_9e.bin",    0x0000, 0x1000, 0x5fb0a1a3 )
  566.     ROM_LOAD( "a4_9f.bin",    0x1000, 0x1000, 0x7871206e )
  567.     ROM_LOAD( "a4_9j.bin",    0x2000, 0x1000, 0xb2da8b77 )
  568.     ROM_LOAD( "a4_9k.bin",    0x3000, 0x1000, 0x36b6a944 )
  569.     ROM_LOAD( "a4_9m.bin",    0x4000, 0x1000, 0xb8e75eb6 )
  570.     ROM_LOAD( "a4_9n.bin",    0x5000, 0x1000, 0x83fccb1c )
  571.  
  572.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  573.     ROM_LOAD( "a2_1e.bin",    0x0000, 0x1000, 0xf217ac09 )
  574.     ROM_LOAD( "j1_b04.bin",   0x1000, 0x1000, 0xc680ef04 )
  575.  
  576.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  577.     ROM_LOAD( "a2_1c.bin",    0x0000, 0x1000, 0xf3e11bd7 )
  578.     ROM_LOAD( "a2_1f.bin",    0x1000, 0x1000, 0xd0f7105b )
  579.  
  580.     ROM_REGION( 0x0040, REGION_PROMS )
  581.     ROM_LOAD( "p3.bin",       0x0000, 0x0020, 0x2a855523 )
  582.     ROM_LOAD( "r3.bin",       0x0020, 0x0020, 0xae6f1019 )
  583.  
  584.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* data for the TMS5110 speech chip */
  585.     ROM_LOAD( "r9_b11.bin",   0x0000, 0x1000, 0x2e0057ff )
  586.     ROM_LOAD( "t9_b12.bin",   0x1000, 0x1000, 0xb2120edd )
  587. ROM_END
  588.  
  589. ROM_START( sbagman )
  590.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  591.     ROM_LOAD( "5.9e",         0x0000, 0x1000, 0x1b1d6b0a )
  592.     ROM_LOAD( "6.9f",         0x1000, 0x1000, 0xac49cb82 )
  593.     ROM_LOAD( "7.9j",         0x2000, 0x1000, 0x9a1c778d )
  594.     ROM_LOAD( "8.9k",         0x3000, 0x1000, 0xb94fbb73 )
  595.     ROM_LOAD( "9.9m",         0x4000, 0x1000, 0x601f34ba )
  596.     ROM_LOAD( "10.9n",        0x5000, 0x1000, 0x5f750918 )
  597.     ROM_LOAD( "13.8d",        0xc000, 0x0e00, 0x944a4453 )
  598.     ROM_CONTINUE(             0xfe00, 0x0200 )
  599.     ROM_LOAD( "14.8f",        0xd000, 0x0400, 0x83b10139 )
  600.     ROM_CONTINUE(             0xe400, 0x0200 )
  601.     ROM_CONTINUE(             0xd600, 0x0a00 )
  602.     ROM_LOAD( "15.8j",        0xe000, 0x0400, 0xfe924879 )
  603.     ROM_CONTINUE(             0xd400, 0x0200 )
  604.     ROM_CONTINUE(             0xe600, 0x0a00 )
  605.     ROM_LOAD( "16.8k",        0xf000, 0x0e00, 0xb77eb1f5 )
  606.     ROM_CONTINUE(             0xce00, 0x0200 )
  607.  
  608.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  609.     ROM_LOAD( "2.1e",         0x0000, 0x1000, 0xf4d3d4e6 )
  610.     ROM_LOAD( "4.1j",         0x1000, 0x1000, 0x2c6a510d )
  611.  
  612.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  613.     ROM_LOAD( "1.1c",         0x0000, 0x1000, 0xa046ff44 )
  614.     ROM_LOAD( "3.1f",         0x1000, 0x1000, 0xa4422da4 )
  615.  
  616.     ROM_REGION( 0x0040, REGION_PROMS )
  617.     ROM_LOAD( "p3.bin",       0x0000, 0x0020, 0x2a855523 )
  618.     ROM_LOAD( "r3.bin",       0x0020, 0x0020, 0xae6f1019 )
  619.  
  620.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* data for the TMS5110 speech chip */
  621.     ROM_LOAD( "11.9r",        0x0000, 0x1000, 0x2e0057ff )
  622.     ROM_LOAD( "12.9t",        0x1000, 0x1000, 0xb2120edd )
  623. ROM_END
  624.  
  625. ROM_START( sbagmans )
  626.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  627.     ROM_LOAD( "sbag_9e.bin",  0x0000, 0x1000, 0xc19696f2 )
  628.     ROM_LOAD( "6.9f",         0x1000, 0x1000, 0xac49cb82 )
  629.     ROM_LOAD( "7.9j",         0x2000, 0x1000, 0x9a1c778d )
  630.     ROM_LOAD( "8.9k",         0x3000, 0x1000, 0xb94fbb73 )
  631.     ROM_LOAD( "sbag_9m.bin",  0x4000, 0x1000, 0xb21e246e )
  632.     ROM_LOAD( "10.9n",        0x5000, 0x1000, 0x5f750918 )
  633.     ROM_LOAD( "13.8d",        0xc000, 0x0e00, 0x944a4453 )
  634.     ROM_CONTINUE(             0xfe00, 0x0200 )
  635.     ROM_LOAD( "sbag_f8.bin",  0xd000, 0x0400, 0x0f3e6de4 )
  636.     ROM_CONTINUE(             0xe400, 0x0200 )
  637.     ROM_CONTINUE(             0xd600, 0x0a00 )
  638.     ROM_LOAD( "15.8j",        0xe000, 0x0400, 0xfe924879 )
  639.     ROM_CONTINUE(             0xd400, 0x0200 )
  640.     ROM_CONTINUE(             0xe600, 0x0a00 )
  641.     ROM_LOAD( "16.8k",        0xf000, 0x0e00, 0xb77eb1f5 )
  642.     ROM_CONTINUE(             0xce00, 0x0200 )
  643.  
  644.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  645.     ROM_LOAD( "2.1e",         0x0000, 0x1000, 0xf4d3d4e6 )
  646.     ROM_LOAD( "4.1j",         0x1000, 0x1000, 0x2c6a510d )
  647.  
  648.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  649.     ROM_LOAD( "sbag_1c.bin",  0x0000, 0x1000, 0x262f870a )
  650.     ROM_LOAD( "sbag_1f.bin",  0x1000, 0x1000, 0x350ed0fb )
  651.  
  652.     ROM_REGION( 0x0040, REGION_PROMS )
  653.     ROM_LOAD( "p3.bin",       0x0000, 0x0020, 0x2a855523 )
  654.     ROM_LOAD( "r3.bin",       0x0020, 0x0020, 0xae6f1019 )
  655.  
  656.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* data for the TMS5110 speech chip */
  657.     ROM_LOAD( "11.9r",        0x0000, 0x1000, 0x2e0057ff )
  658.     ROM_LOAD( "12.9t",        0x1000, 0x1000, 0xb2120edd )
  659. ROM_END
  660.  
  661. ROM_START( pickin )
  662.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  663.     ROM_LOAD( "9e",           0x0000, 0x1000, 0xefd0bd43 )
  664.     ROM_LOAD( "9f",           0x1000, 0x1000, 0xb5785a23 )
  665.     ROM_LOAD( "9j",           0x2000, 0x1000, 0x65ee9fd4 )
  666.     ROM_LOAD( "9k",           0x3000, 0x1000, 0x7b23350e )
  667.     ROM_LOAD( "9m",           0x4000, 0x1000, 0x935a7248 )
  668.     ROM_LOAD( "9n",           0x5000, 0x1000, 0x52485d1d )
  669.  
  670.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  671.     ROM_LOAD( "1f",           0x0000, 0x1000, 0xc5e96ac6 )
  672.     ROM_LOAD( "1j",           0x1000, 0x1000, 0x41c4ac1c )
  673.  
  674.     /* no gfx2 */
  675.  
  676.     ROM_REGION( 0x0040, REGION_PROMS )
  677.     ROM_LOAD( "6331-1.3p",    0x0000, 0x0020, 0xfac81668 )
  678.     ROM_LOAD( "6331-1.3r",    0x0020, 0x0020, 0x14ee1603 )
  679. ROM_END
  680.  
  681.  
  682.  
  683. GAMEX(1982, bagman,   0,       bagman, bagman,  0, ROT270, "Valadon Automation", "Bagman", GAME_IMPERFECT_SOUND )
  684. GAMEX(1982, bagnard,  bagman,  bagman, bagman,  0, ROT270, "Valadon Automation", "Le Bagnard", GAME_IMPERFECT_SOUND )
  685. GAMEX(1982, bagmans,  bagman,  bagman, bagmans, 0, ROT270, "Valadon Automation (Stern license)", "Bagman (Stern set 1)", GAME_IMPERFECT_SOUND )
  686. GAMEX(1982, bagmans2, bagman,  bagman, bagman,  0, ROT270, "Valadon Automation (Stern license)", "Bagman (Stern set 2)", GAME_IMPERFECT_SOUND )
  687. GAMEX(1984, sbagman,  0,       bagman, sbagman, 0, ROT270, "Valadon Automation", "Super Bagman", GAME_IMPERFECT_SOUND )
  688. GAMEX(1984, sbagmans, sbagman, bagman, sbagman, 0, ROT270, "Valadon Automation (Stern license)", "Super Bagman (Stern)", GAME_IMPERFECT_SOUND )
  689. GAME( 1983, pickin,   0,       pickin, pickin,  0, ROT270, "Valadon Automation", "Pickin'" )
  690.